#include <catch2/catch.hpp>

#include "solution.hpp"

using namespace solution_073;

TEST_CASE("073_set_matrix_zeroes", "[073]") {
    SECTION("example 1") {
        std::vector< std::vector<int> > matrix{{1,1,1},{1,0,1},{1,1,1}};
        Solution().setZeroes(matrix);
        CHECK(matrix == std::vector< std::vector<int> >{{1,0,1},{0,0,0},{1,0,1}});
    }

    SECTION("example 2") {
        std::vector< std::vector<int> > matrix{{0,1,2,0},{3,4,5,2},{1,3,1,5}};
        Solution().setZeroes(matrix);
        CHECK(matrix == std::vector< std::vector<int> >{{0,0,0,0},{0,4,5,0},{0,3,1,0}});
    }

    SECTION("example 3") {
        std::vector< std::vector<int> > matrix{{1,0}};
        Solution().setZeroes(matrix);
        CHECK(matrix == std::vector< std::vector<int> >{{0,0}});
    }

    SECTION("example 4") {
        std::vector< std::vector<int> > matrix{{1,2,3,4},{5,0,7,8},{0,10,11,12},{13,14,15,0}};
        Solution().setZeroes(matrix);
        CHECK(matrix == std::vector< std::vector<int> >{{0,0,3,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}});
    }
}
